<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="./template/TCubeTemplate.xhtml">

    <ui:define name="contentInsert">
        <h:body>
            <h:form id="formMain">
                <h1>MyPrimeFacesOrganizer - Powered by PrimeFaces 2.2.1</h1>

                <p:panel id="panel" header="Create New Service">
                    <f:metadata>
                        <f:viewParam name ="visibility" value ="#{tCubeManagerBean.selectedServicePackage.visibility}" />
                    </f:metadata>
                    <p:ajaxStatus style="width:16px;height:16px;">
                        <f:facet name="start">
                            <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                        </f:facet>
                        <f:facet name="complete">
                            <h:outputText value="" />
                        </f:facet>
                    </p:ajaxStatus>
                    <p:messages />
                    <h:panelGrid columns="3" cellpadding="10">
                        <h:outputLabel for="name" style="font-weight: bold" value="Service name: " />
                        <h:inputText required="true" label="Branch Name" requiredMessage="Service name is required." id="name" value="#{tCubeManagerBean.selectedServicePackage.name}">
                        </h:inputText>
                        <p:message for="name" />

                        <h:outputLabel for="description" style="font-weight: bold" value="Description: " />
                        <p:inputTextarea required="true" label="Description" requiredMessage="Description is required." id="description" value="#{tCubeManagerBean.selectedServicePackage.description}">
                        </p:inputTextarea>
                        <p:message for="description" />

                        <h:outputLabel for="price" style="font-weight: bold" value="Price: " />
                        <h:inputText required="true" label="Price" requiredMessage="Price is required." id="price" value="#{tCubeManagerBean.selectedServicePackage.price}">
                        </h:inputText>
                        <p:message for="price" />

                        <p:commandButton value="Visible" disabled="#{tCubeManagerBean.selectedServicePackage.visibility}"  action="TCubeEditServicePackageInfo?faces-redirect=true" ajax="true">
                            <f:param name="visibility" value="true" />
                        </p:commandButton>

                        <p:commandButton value="Invisible" disabled="#{!tCubeManagerBean.selectedServicePackage.visibility}" action="TCubeEditServicePackageInfo?faces-redirect=true" ajax="true">
                            <f:param name="visibility" value="false" />
                        </p:commandButton>

                        <h:outputLabel for="blank" style="font-weight: bold" value=""/>
                        <p:dataTable var="service" value="#{tCubeManagerBean.listOfServices}" selection="#{tCubeManagerBean.selectedServices}" paginator="true" rows="10">
                            <p:column selectionMode="multiple" />

                            <p:column headerText="Name">
                                <h:outputText value="#{service.name}" />
                            </p:column>

                            <p:column headerText="Description">
                                <h:outputText value="#{service.description}" />
                            </p:column>
                        </p:dataTable>
                    </h:panelGrid>
                    <p:commandButton id="btn" value="Edit Service Package Info" update="panel" actionListener="#{tCubeManagerBean.editServicePackageInfo}" ajax="true" />
                </p:panel>
            </h:form>
        </h:body>
    </ui:define>
</ui:composition>